import 'package:boss/ui/widget/image/base_image.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

final _iconMap = {
  1: 'goods_discount.png',
  2: 'goods_offer.png',
  3: 'goods_gift.png',
};

class CommodityDiscountIcon extends StatelessWidget {
  final int discountType;
  final int commodityType;

  const CommodityDiscountIcon(this.discountType, this.commodityType);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: <Widget>[
        if (_iconMap.containsKey(discountType))
          Container(
            margin: EdgeInsets.only(left: 8.w, bottom: ScreenUtil.instance.setWidth(12.5)),
            child: BaseImage(
              'assets/image/' + _iconMap[discountType],
              width: 25.w,
              height: 25.w,
            ),
          ),
        if (commodityType == 3)
          Container(
            margin: EdgeInsets.only(left: 8.w, bottom: ScreenUtil.instance.setWidth(12.5)),
            child: BaseImage(
              'assets/image/goods_package.png',
              width: 25.w,
              height: 25.w,
            ),
          ),
      ],
    );
  }
}
